package org.example.stream;

import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.IntStream;

public class Stream04 {
    /**
     * 生成流
     */
    public static void main(String[] args) {
        IntStream.range(1,10).forEach(System.out::println);
        System.out.println("------------------------");
        IntStream.rangeClosed(1,10).forEach(System.out::println);
        System.out.println("------------------------");
        IntStream.iterate(1,i->i+2).limit(5).forEach(System.out::println);
        System.out.println("------------------------");
        IntStream.generate(()-> ThreadLocalRandom.current().nextInt(100)).limit(5).forEach(System.out::println);
        System.out.println("------------------------");
        ThreadLocalRandom.current().ints(5,0,100).forEach(System.out::println);
    }
}
